<?php
/**确认收货异步通知页*/
$out_trade_no = $_POST['order_id'];
$trade_status = $_POST['trade_status'];
$mysign = $_POST['mysign'];
require_once ("config.php");

$cod_verify = new CodVerify($cod_config['key']);
$verify_result = $cod_verify->md5Verify($out_trade_no . $trade_status, $mysign);
if ($trade_status == 'SUCCESS' && $verify_result) {
    include_once ($config["webroot"] . "/module/product/includes/plugin_order_class.php");
    $order = new order();
    $order_statu = $order->set_order_statu($out_trade_no, 0);
    echo "success"; // 请不要修改或删除
} else {
    
    // //验证失败
    echo "fail";
    
    // 调试用，写文本函数记录程序运行情况是否正常
    // logResult("这里写入想要调试的代码变量值，或其他运行的结果记录");
}

class CodVerify
{

    var $signKey;

    function __construct($signKey)
    {
        $this->signKey = $signKey;
    }

    function md5Verify($prestr, $sign)
    {
        $prestr = $prestr . $this->signKey;
        $mysgin = md5($prestr);
        
        if ($mysgin == $sign) {
            return true;
        } else {
            return false;
        }
    }
}




